//
//  GZGJDetailCell1.m
//  Tunnel
//
//  Created by wbb on 2025/6/15.
//

#import "AQJCDetailCell1.h"
#import "AQJCModel.h"
#import "SDWebImage.h"
#import "GJSCImageView.h"

@implementation AQJCDetailCell1

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.titleLab.text = @"";
    self.clbzLab.text = @"";
    self.imgView1.hidden = YES;
    self.imgView2.hidden = YES;
    self.imgView3.hidden = YES;
    
    [self.imgView1 addTarget:self action:@selector(imgClick1)];
    [self.imgView2 addTarget:self action:@selector(imgClick2)];
    [self.imgView3 addTarget:self action:@selector(imgClick3)];
}

- (void)cellWithData:(id)data andIndex:(NSInteger )index {
    NSArray *arr = (NSArray *)data;
    ProgressMirror * model = arr[index];
    self.titleLab.text = [NSString stringWithFormat:@"%@ %@",model.czrRole,model.czrName] ;
    self.clbzLab.text = [model.cznr stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n"];
    self.timeLab.text = model.czsj;
    NSArray *imgList = model.fjList;
    // 设置图片
    for (int i = 0 ; i< imgList.count; i++) {
        YJFJModel * fj = imgList[i] ;
       
        if(i == 0){
            [self.imgView1 sd_setImageWithURL:[NSURL URLWithString:fj.url] placeholderImage:[UIImage imageNamed:@"yxjc_icon"]];
            self.imgView1.hidden = false;
        }
        if(i == 1){
            [self.imgView2 sd_setImageWithURL:[NSURL URLWithString:fj.url] placeholderImage:[UIImage imageNamed:@"yxjc_icon"]];
            self.imgView2.hidden = false;

        }
        if(i == 2){
            [self.imgView3 sd_setImageWithURL:[NSURL URLWithString:fj.url] placeholderImage:[UIImage imageNamed:@"yxjc_icon"]];
            self.imgView3.hidden = false;


        }
    }
    if(index == arr.count - 1) {
        self.lineView.hidden = YES;
    }else {
        self.lineView.hidden = NO;
    }
}
- (void)imgClick1 {
    [self openImgView:self.imgView1.image];
}
- (void)imgClick2 {
    [self openImgView:self.imgView1.image];
}
- (void)imgClick3 {
    [self openImgView:self.imgView1.image];
}
- (void)openImgView:(UIImage *)image {
    GJSCImageView *scImgView = (GJSCImageView *)[GJSCImageView nibView];
    [kWindow addSubview:scImgView];
    [scImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.offset(0);
    }];
    scImgView.image = image;
}
@end
